<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>17商城</title>
    <link type="text/css" href="css/css.css" rel="stylesheet"/>
    <link rel="stylesheet" href="css/page.css">
    <script type="text/javascript" src="js/jquery.js"></script>
    <script type="text/javascript" src="js/js.js"></script>
    <script src="js/wb.js" type="text/javascript" charset="utf-8"></script>
    <script type="text/javascript">
        $(function () {
            $.get("${pageContext.request.contextPath}/goodsType", data => {
                let str = ""
                Array.from(data)
                for (let i = 0; i < data.length; i++) {
                    if (i === ${param.tid-1}) {
                        str += `<li class="navCur"><a href='${pageContext.request.contextPath}/goods?tid=` + data[i].tid + `'>` + data[i].tname + `</a></li>`
                    } else {
                        str += `<li><a href='${pageContext.request.contextPath}/goods?tid=` + data[i].tid + `'>` + data[i].tname + `</a></li>`
                    }
                }
                $("#t001").html(str)
                $("#t002").html(str)
            }, "json")

        })
    </script>
</head>

<body>
<div class="mianCont">
    <div class="top">
        <span>您好！欢迎来到17商城 请&nbsp;<a href="login.jsp">[登录]</a>&nbsp;<a href="reg.jsp">[注册]</a></span>
        <span class="topRight">
    <a href="vip.jsp">我的17</a>&nbsp;|
    <a href="order.jsp">我的订单</a>&nbsp;|
    <a href="login.jsp">会员中心</a>&nbsp;|
    <a href="contact.jsp">联系我们</a>
   </span>
    </div><!--top/-->
    <div class="lsg">
        <h1 class="logo"><a href="index.jsp"><img src="images/logo.png" width="217" height="90"/></a></h1>
        <form action="${pageContext.request.contextPath}/goodsSearch" method="get" class="subBox">
            <div class="subBoxDiv">
                <input type="hidden" value="${param.tid}" name="tid"/>
                <input type="text" class="subLeft" name="gname"/>
                <input type="image" src="images/subimg.png" width="63" height="34" class="sub"/>
            </div><!--subBoxDiv/-->
        </form><!--subBox/-->
        <div class="gouwuche">
            <div class="gouCar">
                <img src="images/gouimg.png" width="19" height="20" style="position:relative;top:6px;"/>&nbsp;|&nbsp;
                <strong class="red">0</strong>&nbsp;件&nbsp;|
                <strong class="red">￥ 0.00</strong>
                <a href="order.jsp">去结算</a> <img src="images/youjian.jpg" width="5" height="8"/>
            </div><!--gouCar/-->
            <div class="myChunlv">
                <a href="vip.jsp"><img src="images/mychunlv.jpg" width="112" height="34"/></a>
            </div><!--myChunlv/-->
        </div><!--gouwuche/-->
    </div><!--lsg/-->

    <div class="pnt">
        <div class="pntLeft">
            <h2 class="Title">所有商品分类
                <ul class="InPorNav">
                    <div id="t001"></div>
                </ul><!--InPorNav/-->
            </h2>
        </div><!--pntLeft/-->
        <div class="pntRight">
            <ul class="nav">
                <li><a href="index.jsp">商城首页</a></li>
                <div id="t002"></div>
                <div class="clears"></div>
                <div class="phone">TEL：021-12345678</div>
            </ul><!--nav/-->
        </div><!--pntRight/-->
        <div class="clears"></div>
    </div><!--pnt/-->

    <div class="positions">
        当前位置：<a href="index.jsp">首页</a> &gt; <a href="#" class="posCur">种类</a>
    </div><!--positions/-->

    <div class="cont">
        <div class="jilu">
            总计 <span>${ipage.totalcount}</span> 个记录
        </div><!--jilu/-->
        <div class="contLeft">
            <ul class="leftPorNav">
                <img src="${pageContext.request.contextPath}/gimages/longleft.jpg" width="180" height="290"/>
            </ul><!--InPorNav/-->
        </div><!--contLeft/-->
        <div class="contRight">
            <div class="frProList">
                <%--动态商品--%>
                <%int i = 0;%>
                <c:forEach items="${ipage.lists}" var="item">
                    <%i++;%>
                    <dl>
                        <dt><a href="${pageContext.request.contextPath}/goodsInfo?gid=${item.gid}"><img
                                src="${pageContext.request.contextPath}/gimages/${item.g_img}" width="132" height="129"/></a></dt>
                        <dd>${item.gname}</dd>
                        <dd class="cheng">￥${item.price}</dd>
                    </dl>
                    <c:if test="i eq 4">
                        <%i = 0;%>
                        <div class="clears"></div>
                    </c:if>
                </c:forEach>
                <div class="clears"></div>
            </div><!--frProList-->
        </div><!--contRight/-->
        <div class="clears"></div>
    </div><!--cont/-->

    <!--分页 -->
    <br>
    <div id="page-normal">

        <c:choose>
            <c:when test="${ipage.nowpage eq 1}">
                <a id="page-prev" href="" style="pointer-events:none"><i></i>上一页</a>
            </c:when>
            <c:otherwise>
                <a id="page-prev" href="${ipage.url}&nowpage=${ipage.nowpage-1}"><i></i>上一页</a>
            </c:otherwise>
        </c:choose>

        <c:forEach begin="1" end="${ipage.totalpage}" step="1" var="i">
            <c:choose>
                <c:when test="${ipage.nowpage eq i}">
                    <a class="page-current" href="${ipage.url}&nowpage=${i}"> ${i} </a>
                </c:when>
                <c:otherwise>
                    <a href="${ipage.url}&nowpage=${i}"> ${i} </a>
                </c:otherwise>
            </c:choose>
        </c:forEach>
        <c:choose>
            <c:when test="${ipage.nowpage eq ipage.totalpage}">
                <a id="page-next" href="#" style="pointer-events:none">下一页<i></i></a>
            </c:when>
            <c:otherwise>
                <a id="page-next" href="${ipage.url}&nowpage=${ipage.nowpage+1}">下一页<i></i></a>
            </c:otherwise>
        </c:choose>
    </div>
    <%--分页end--%>
</div><!--mianCont/-->
<a href="#" class="backTop">&nbsp;top</a>
</body>
</html>
